package com.shop.controller;

import com.github.pagehelper.PageInfo;
import com.shop.entity.OrderDetail;
import com.shop.entity.OrderMaster;
import com.shop.service.OrderDetailService;
import com.shop.service.OrderMasterService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import javax.annotation.Resource;
import java.util.List;

/**
 * description: 该文件说明
 *
 * @author zhaoxiaozhao（xiaozhao.zhao@ucarinc.com）
 * @version 1.0
 * @date 2018/10/15 14:27
 **/
@Controller
@RequestMapping("/orderDetail")
public class OrderDetailController {

    @Resource
    private OrderDetailService orderDetailService;
    /**
     * description:<商品管理的界面>
     *
     * @author zhaoxiaozhao（xiaozhao.zhao@ucarinc.com）
     * @date   2018/10/9 13:40
     * @param
     * @return
     **/
    @RequestMapping("/orderDetailList")
    public ModelAndView orderDetailList(){
        ModelAndView view = new ModelAndView("orderDetailList");
        return view;
    }

    /**
     * description:<订单详情管理查找>
     *
     * @param
     * @return
     * @author zhaoxiaozhao（xiaozhao.zhao@ucarinc.com）
     * @date 2018/10/9 13:40
     **/
    @RequestMapping("/getOrderDetailList")
    @ResponseBody
    public PageInfo<OrderDetail> getOrderDetailList(@RequestParam(value = "page", defaultValue = "1") Integer page, @RequestParam(value = "rows", defaultValue = "2") Integer rows, OrderDetail orderDetail) {
        PageInfo<OrderDetail> pageInfo =  orderDetailService.findOrderDetailList(page,rows,orderDetail);
        return pageInfo;
    }

    /**
     * description:<商品管理的界面>
     *
     * @author zhaoxiaozhao（xiaozhao.zhao@ucarinc.com）
     * @date   2018/10/9 13:40
     * @param
     * @return
     **/
    @RequestMapping("/orderDetailPage")
    public ModelAndView orderDetail(){
        ModelAndView view = new ModelAndView("orderDetailPage");
        return view;
    }

    /**
     * description:<通过订单id查找订单详情>
     *
     * @param
     * @return
     * @author zhaoxiaozhao（xiaozhao.zhao@ucarinc.com）
     * @date 2018/10/9 13:40
     **/
    @RequestMapping("/findOrderDetailByOrderId")
    @ResponseBody
    public List<OrderDetail> findOrderDetailByOrderId(@RequestParam(value = "orderId") String orderId) {
        List<OrderDetail>  list =  orderDetailService.findOrderDetailByOrderId(orderId);
        return list;
    }

}
